#pragma once
#include <grpcpp/grpcpp.h>
#include "message.grpc.pb.h"
#include "message.pb.h"
#include <mutex>
#include "data.h"

using grpc::Server;
using grpc::ServerBuilder;
using grpc::ServerContext;
using grpc::Status;
using message::AddFriendReq;
using message::AddFriendRsp;

using message::AuthFriendReq;
using message::AuthFriendRsp;

using message::ChatService;
using message::TextChatMsgReq;
using message::TextChatMsgRsp;
using message::TextChatData;


class ChatServiceImpl final:public ChatService::Service
{
public:
	ChatServiceImpl();
    Status NotifyAddFriend(ServerContext* context, const AddFriendReq* request,
        AddFriendRsp* response) override;

    //Status RplyAddFriend(ServerContext* context, const ::message::RplyFriendReq* request,
    //    ::message::RplyFriendRsp* response) override;

    //Status SendChatMsg(ServerContext* context, const ::message::SendChatMsgReq* request,
    //    ::message::SendChatMsgRsp* response) override;

    Status NotifyAuthFriend(ServerContext* context, const AuthFriendReq* request,
        AuthFriendRsp* reply) override;

    Status NotifyTextChatMsg(ServerContext* context, const TextChatMsgReq* request,
        TextChatMsgRsp* reply) override;

    bool GetBaseInfo(std::string base_key, int uid, std::shared_ptr<UserInfo>& userinfo);
};

